package cn.community.care.module.system.dal.mysql.inventoryinfo;

import java.util.*;

import cn.community.care.framework.common.pojo.PageResult;
import cn.community.care.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.community.care.framework.mybatis.core.mapper.BaseMapperX;
import cn.community.care.module.system.dal.dataobject.inventoryinfo.InventoryInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.community.care.module.system.controller.admin.inventoryinfo.vo.*;

/**
 * 库存信息 Mapper
 *
 * @author 美妆管理员
 */
@Mapper
public interface InventoryInfoMapper extends BaseMapperX<InventoryInfoDO> {

    default PageResult<InventoryInfoDO> selectPage(InventoryInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InventoryInfoDO>()
                .betweenIfPresent(InventoryInfoDO::getEntryDate, reqVO.getEntryDate())
                .eqIfPresent(InventoryInfoDO::getEntryQuantity, reqVO.getEntryQuantity())
                .eqIfPresent(InventoryInfoDO::getStockQuantity, reqVO.getStockQuantity())
                .eqIfPresent(InventoryInfoDO::getSafetyStock, reqVO.getSafetyStock())
                .eqIfPresent(InventoryInfoDO::getLocation, reqVO.getLocation())
                .betweenIfPresent(InventoryInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InventoryInfoDO::getId));
    }

}